﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace AssignmentsManage.TemplateSelectors
{
    public class TitleValueItemTemplateSelector : System.Windows.Controls.DataTemplateSelector
    {
        public DataTemplate TitleValueItemHeaderTemplate { get; set; }
        public DataTemplate TitleValueItemCheckableTemplate { get; set; }
        public override DataTemplate SelectTemplate(object item,
            DependencyObject container)
        {
            if (item != null)
            {
                if (item.GetType() == typeof(SetCLib.TitleValueItem))
                {
                    if (((SetCLib.TitleValueItem)item).IsHeader == false)
                    {
                        return this.TitleValueItemCheckableTemplate;
                    }
                    else
                    {
                        return this.TitleValueItemHeaderTemplate;
                    }
                }
            }

            return null;
        }
    }
}
